package com.gjy.service.es.config;

import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-07-03 09:34:42
 */
@Configuration
public class EsConfig {

    @Value("${customer.es}")
    private String uris;

    @Bean
    public RestHighLevelClient esClient() {
        ClientConfiguration build = ClientConfiguration.builder()
                .connectedTo(uris)
                .build();
        return RestClients.create(build).rest();
    }
}
